主题
获取软件更新日志 - GetSoftUpdateLogs
函数简介
分页获取指定软件的正式版已发布版本更新日志列表,用于在客户端展示「版本历史 / 更新说明」页面。
与 获取软件更新状态 - GetSoftUpdateStatus 的区别:
| 接口 | 用途 |
|---|---|
GetSoftUpdateStatus | 检测是否有新版本,并在有更新时返回最新一条版本的安装包信息。 |
GetSoftUpdateLogs | 返回多条历史版本的更新说明(不含下载地址),支持分页。 |
服务端仅返回 VersionType = 1(正式版)且 Status = 已发布 的记录;测试版、内测版、未发布版本不会暴露给客户端。
返回数据格式:
json
{
"Code": 1,
"Message": "success",
"TotalCount": 12,
"CurrentVersion": "1.0.0",
"LatestVersion": "3.0.0",
"Items": [
{
"Guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"VersionNumber": "3.0.0",
"VersionName": "正式版",
"UpdateContent": "1. 修复登录问题\n2. 优化性能",
"ReleaseDate": "2025-06-01T00:00:00",
"PublishTime": "2025-06-01T10:30:00",
"IsLatest": true,
"IsForceUpdate": false,
"IsCurrent": false
}
]
}| 字段名 | 类型 | 说明 |
|---|---|---|
| Code | 整数 | 结果状态码,通常 1 表示成功,0 表示失败(含软件不可用、参数错误等)。 |
| Message | 字符串 | 提示信息或错误信息;失败时多为 错误码:中文描述(如 "2003:参数无效")。成功时常为 success。完整对照见 客户端错误码说明。 |
| TotalCount | 整数 | 符合条件的总条数(不受当前页大小影响)。 |
| CurrentVersion | 字符串 | 客户端上报的当前软件版本(回显)。 |
| LatestVersion | 字符串 | 最新正式版版本号。 |
| Items | 数组 | 当前页的更新日志列表。 |
常见错误码(Message 字段)
| Message | 含义 |
|---|---|
2003:参数无效 | 参数无效 |
2004:用户不存在 | 用户不存在 |
2005:软件不可用或未开通 | 软件不可用或未开通 |
Items 字段说明:
| 字段名 | 类型 | 说明 |
|---|---|---|
| Guid | 字符串 | 版本唯一标识。 |
| VersionNumber | 字符串 | 版本号,如 3.0.0。 |
| VersionName | 字符串 | 版本名称。 |
| UpdateContent | 字符串 | 更新说明 / 变更日志正文。 |
| ReleaseDate | 字符串 | 对外发布日期。 |
| PublishTime | 字符串 | 系统发布时间。 |
| IsLatest | 布尔 | 是否为最新正式版。 |
| IsForceUpdate | 布尔 | 是否强制更新。 |
| IsCurrent | 布尔 | 是否等于请求参数中的 softVersion。 |
接口名称
GetSoftUpdateLogsDLL调用
long GetSoftUpdateLogs(string userCode, string softCode, string softVersion, string dealerCode, int skipCount, int maxResultCount);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| userCode | 字符串 | 用户码。 |
| softCode | 字符串 | 软件码。 |
| softVersion | 字符串 | 当前软件版本(可选,用于标记 IsCurrent;传空字符串亦可)。 |
| dealerCode | 字符串 | 经销商码。 |
| skipCount | 整数 | 分页偏移,从 0 开始。 |
| maxResultCount | 整数 | 每页条数;传 0 时服务端默认 20,最大 100。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功
// 第二页
OlaAuthSoftUpdateLogsReturn result2 = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20);csharp
using OLAPlug;
var ola = new OLAPlugServer();
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功
OlaAuthSoftUpdateLogsReturn result2 = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
json_result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
# Python SDK 返回 JSON 字符串,需自行解析java
import com.olaplug.OLAPlugServer;
import com.olaplug.model.OlaAuthSoftUpdateLogsReturn;
OLAPlugServer ola = new OLAPlugServer();
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
result := ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)
// result.Code == 1 表示成功
result2 := ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20)rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let result = ola.get_soft_update_logs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.code == 1 表示成功
let result2 = ola.get_soft_update_logs("userCode", "softCode", "1.0.0", "dealerCode", 20, 20);cpp
var ola = com("OlaPlug.OlaSoft")
var result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
Set result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)text
.局部变量 ola, OLAPlug
.局部变量 result, OlaAuthSoftUpdateLogsReturn
ola.创建 ()
result = ola.GetSoftUpdateLogs(“userCode”, “softCode”, “1.0.0”, “dealerCode”, 0, 20)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var json = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// Aardio SDK 返回 JSON 字符串,需自行解析text
变量 ola <类型 = OLAPlugServer>
变量 result <类型 = OlaAuthSoftUpdateLogsReturn>
ola = 新建 OLAPlugServer
result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
OlaAuthSoftUpdateLogsReturn result = ola.GetSoftUpdateLogs("userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
// result.Code == 1 表示成功原生 DLL 调用
cpp
long ptr = GetSoftUpdateLogs(instance, "userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
if (ptr != 0) {
char buffer[2048] = {0};
GetStringFromPtr(ptr, buffer, sizeof(buffer));
FreeStringPtr(ptr);
}csharp
using System.Runtime.InteropServices;
using System.Text;
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringFromPtr(long ptr, StringBuilder lpString, int size);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int FreeStringPtr(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int GetStringSize(long ptr);
[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern long GetSoftUpdateLogs(string userCode, string softCode, string softVersion, string dealerCode, int skipCount, int maxResultCount);
long ptr = GetSoftUpdateLogs(instance, "userCode", "softCode", "1.0.0", "dealerCode", 0, 20);
if (ptr != 0) {
StringBuilder sb = new StringBuilder(GetStringSize(ptr) + 1);
GetStringFromPtr(ptr, sb, sb.Capacity);
FreeStringPtr(ptr);
string result = sb.ToString();
}python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ptr = ola.GetSoftUpdateLogs(instance, b"userCode", b"softCode", b"1.0.0", b"dealerCode", 0, 20)
if ptr:
buf = create_string_buffer(2048)
ola.GetStringFromPtr(ptr, buf, 2048)
ola.FreeStringPtr(ptr)
result = buf.value.decode("utf-8")返回值
| 调用方式 | 返回值 | 说明 |
|---|---|---|
| SDK | OlaAuthSoftUpdateLogsReturn | 结构化返回对象;Code == 1 表示成功 |
| 原生 DLL | 非 0 | 成功,返回 JSON 字符串格式的结果。 |
| 原生 DLL | 0 | 失败。 |
注意事项
| 项目 | 说明 |
|---|---|
| 释放内存 | 返回的字符串指针需要调用 FreeStringPtr 接口释放内存。 |
| 数据范围 | 仅包含正式版 + 已发布版本;测试版、内测版、待发布版本不会返回。 |
| 分页遍历 | 根据 TotalCount 与 skipCount、maxResultCount 循环请求直至取完所有页。 |
| 下载安装包 | 本接口不返回 FileUrl、FileMd5 等下载信息;需要下载地址时请使用 GetSoftUpdateStatus。若要自动下载并安装,请使用 SoftUpdateStart。 |
| 登录前置 | 建议先 Login 成功后再调用,确保用户码、软件码有效。 |
